<?php

namespace app\common\model;

use think\Model;

/**
 * 会员余额日志模型
 */
class MoneyLog Extends Model
{

    // 表名
    protected $name = 'user_money_log';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = '';
    // 追加属性
    protected $append = [
    ];
    /**
     * @param $money_type  变动类型:0=无,1=二级分润,2=代理奖励,3=服务中心奖励,4=分红奖励,5=股权奖励,6=充值,7=提现,8=贡献值,9=消费,10=货款
     * @param $user_id
     * @param string $money
     * @return mixed
     */
    public static function MyTotalMoney($money_type,$user_id,$money='money'){
        $model = new self();
        $where['money_type'] = $money_type;
        $where['user_id'] = $user_id;

        $data = $model->where($where)->sum($money);
        return $data;
    }
}
